﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core
{
    public static partial class msg
    {
        public static dynamic getDiscussCount(int pid)
        {
            var sql = new Sql.SqlDataContext();
            var d = sql.Problem.FirstOrDefault(row => row.pid == pid);
            if (d == null) return new
                {
                    success = false,
                    msg = "题目不存在"
                };
            var count = sql.Discuss.Count(row => row.pid == pid);
            return new
            {
                success = true,
                count
            };
        }
    }
}